'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH FSCK_UFS 8 "Aug 2, 2005"
.SH NAME
fsck_ufs \- file system consistency check and interactive repair
.SH SYNOPSIS
.LP
.nf
\fBfsck\fR \fB-F\fR ufs [\fIgeneric-options\fR] [\fIspecial\fR]...
.fi

.LP
.nf
\fBfsck\fR \fB-F\fR ufs [\fIgeneric-options\fR] [\fB-o\fR \fIspecific-options\fR]
     [\fIspecial\fR]...
.fi

.SH DESCRIPTION
.sp
.LP
The \fBfsck\fR utility audits and interactively repairs inconsistent conditions
on file systems. A file system to be checked may be specified by giving the
name of the block or character \fIspecial\fR device or by giving the name of
its mount point if a matching entry exists in \fB/etc/vfstab\fR.
.sp
.LP
The \fIspecial\fR parameter represents the character special device, for
example, \fB/dev/rdsk/c1t0d0s7\fR, on which the file system resides. The
character special device, not the block special device should be used. The
\fBfsck\fR utility will not work if the block device is mounted, unless the
file system is error-locked.
.sp
.LP
If no \fIspecial\fR device is specified, all \fBufs\fR file systems specified
in the \fBvfstab\fR with a \fBfsckdev\fR entry will be checked. If the \fB-p\fR
(``preen'') option is specified, \fBufs\fR file systems with an \fBfsckpass\fR
number greater than \fB1\fR are checked in parallel. See \fBfsck\fR(8).
.sp
.LP
In the case of correcting serious inconsistencies, by default, \fBfsck\fR asks
for confirmation before making a repair and waits for the operator to respond
either \fByes\fR or \fBno\fR. If the operator does not have write permission on
the file system, \fBfsck\fR will default to a \fB-n\fR (no corrections) action.
See \fBfsck\fR(8).
.sp
.LP
Repairing some file system inconsistencies can result in loss of data. The
amount and severity of data loss can be determined from the diagnostic output.
.sp
.LP
The \fBfsck\fR utility automatically corrects innocuous inconsistencies such as
unreferenced inodes, too-large link counts in inodes, missing blocks in the
free list, blocks appearing in the free list and also in files, or incorrect
counts in the super block. It displays a message for each inconsistency
corrected that identifies the nature of the correction on the file system which
took place. After successfully correcting a file system, \fBfsck\fR prints the
number of files on that file system, the number of used and free blocks, and
the percentage of fragmentation.
.sp
.LP
Inconsistencies checked include:
.RS +4
.TP
.ie t \(bu
.el o
Blocks claimed by more than one inode or the free list.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Blocks claimed by an inode or the free list outside the range of the file
system.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Incorrect link counts.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Incorrect directory sizes.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Bad inode format.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Blocks not accounted for anywhere.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Directory checks, file pointing to unallocated inode, inode number out of
range, and absence of `\fB\&.\fR' and `\fB\&.\|.\fR' as the first two entries
in each directory.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Super Block checks: more blocks for inodes than there are in the file system.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Bad free block list format.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Total free block and/or free inode count incorrect.
.RE
.sp
.LP
Orphaned files and directories (allocated but unreferenced) are, with the
operator's concurrence, reconnected by placing them in the \fBlost+found\fR
directory. The name assigned is the inode number. If the \fBlost+found\fR
directory does not exist, it is created. If there is insufficient space in the
\fBlost+found\fR directory, its size is increased.
.sp
.LP
An attempt to mount a \fBufs\fR file system with the \fB\fR\fB-o\fR\fB
nolargefiles\fR option will fail if the file system has ever contained a large
file (a file whose size is greater than or equal to 2 Gbyte). Invoking
\fBfsck\fR resets the file system state if no large files are present in the
file system. A successful mount of the file system after invoking \fBfsck\fR
indicates the absence of large files in the file system. An unsuccessful mount
attempt indicates the presence of at least one large file. See
\fBmount_ufs\fR(8).
.SH OPTIONS
.sp
.LP
The \fIgeneric-options\fR consist of the following options:
.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 12n
Check but do not repair. This option checks that the file system is suitable
for mounting, returning the appropriate exit status. If the file system is
ready for mounting, \fBfsck\fR displays a message such as:
.sp
.ne 2
.na
\fB\fR
.ad
.sp .6
.RS 4n
\fBufs fsck: sanity check: /dev/rdsk/c0t3d0s1 okay\fR
.RE

.RE

.sp
.ne 2
.na
\fB\fB-n\fR\||\|\fBN\fR\fR
.ad
.RS 12n
Assume a \fBno\fR response to all questions asked by \fBfsck\fR; do not open
the file system for writing.
.RE

.sp
.ne 2
.na
\fB\fB-V\fR\fR
.ad
.RS 12n
Echo the expanded command line, but do not execute the command. This option may
be used to verify and to validate the command line.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 12n
Enables verbose output. Might not be supported by all filesystem-specific
\fBfsck\fR implementations.
.RE

.sp
.ne 2
.na
\fB\fB-y\fR\||\|\fBY\fR\fR
.ad
.RS 12n
Assume a \fByes\fR response to all questions asked by \fBfsck\fR.
.RE

.sp
.LP
See generic \fBfsck\fR(8) for the details for specifying \fIspecial\fR.
.sp
.ne 2
.na
\fB\fB-o\fR \fIspecific-options\fR\fR
.ad
.RS 23n
Specify \fBufs\fR file system specific options. These options can be any
combination of the following separated by commas (with no intervening spaces).
.sp
.ne 2
.na
\fB\fBb=\fR\fIn\fR\fR
.ad
.RS 7n
Use block \fIn\fR as the super block for the file system. Block 32 is always
one of the alternate super blocks. Determine the location of other super blocks
by running \fBnewfs\fR(8) with the \fB-Nv\fR options specified.
.RE

.sp
.ne 2
.na
\fB\fBf\fR\fR
.ad
.RS 7n
Force checking of file systems regardless of the state of their super block
clean flag.
.RE

.sp
.ne 2
.na
\fB\fBp\fR\fR
.ad
.RS 7n
Check and fix the file system non-interactively ("preen"). Exit immediately if
there is a problem requiring intervention. This option is required to enable
parallel file system checking.
.RE

.sp
.ne 2
.na
\fB\fBw\fR\fR
.ad
.RS 7n
Check writable file systems only.
.RE

.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/vfstab\fR\fR
.ad
.RS 15n
list of default parameters for each file system
.RE

.SH SEE ALSO
.sp
.LP
.BR ufs (4FS),
.BR vfstab (5),
.BR attributes (7),
.BR largefile (7),
.BR clri (8),
.BR fsck (8),
.BR fsdb_ufs (8),
.BR fsirand (8),
.BR fstyp (8),
.BR mkfs (8),
.BR mkfs_ufs (8),
.BR mount_ufs (8),
.BR mountall (8),
.BR newfs (8),
.BR reboot (8)
.SH WARNINGS
.sp
.LP
The operating system buffers file system data. Running \fBfsck\fR on a mounted
file system can cause the operating system's buffers to become out of date with
respect to the disk. For this reason, the file system should be \fIunmounted\fR
when \fBfsck\fR is used. If this is not possible, care should be taken that the
system is quiescent and that it is rebooted immediately after \fBfsck\fR is
run. Quite often, however, this will not be sufficient. A panic will probably
occur if running \fBfsck\fR on a file system modifies the file system.
.SH NOTES
.sp
.LP
It is usually faster to check the character special device than the block
special device.
.sp
.LP
Running \fBfsck\fR on file systems larger than 2 Gb fails if the user chooses
to use the block interface to the device:
.sp
.ne 2
.na
\fB\fBfsck\fR \fB/dev/dsk/c?t?d?s?\fR\fR
.ad
.RS 26n

.RE

.sp
.LP
rather than the raw (character special) device:
.sp
.ne 2
.na
\fB\fBfsck\fR \fB/dev/rdsk/c?t?d?s?\fR\fR
.ad
.RS 27n

.RE

